<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="dragable" style="width: 100px; height: 100px; background-color: pink;">
    </div>
</body>

</html>
<script>
    let dragable = document.getElementById("dragable");
    dragable.addEventListener("mousedown", event => {
        let move = event => {
            console.log(event.clientX, event.clientY);
        }
        let end = event => {
            document.removeEventListener("mousemove", move);
            document.removeEventListener("mouseup", end);
        }
        document.addEventListener("mousemove", move);
        document.addEventListener("mouseup", end)
    })
</script>